//
//  LoadingCell.m
//  QiushiDemo
//
//  Created by 王桂敏 on 15-5-13.
//  Copyright (c) 2015年 lanouhn. All rights reserved.
//

#import "LoadingCell.h"

@interface LoadingCell()
@property (nonatomic,retain) UIActivityIndicatorView *indicator;//风火轮
@property (nonatomic,retain) UILabel *loadingLable;//正在载入中

@end
@implementation LoadingCell

- (void)dealloc{
    [_indicator release];
    [_loadingLable release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self.contentView addSubview:self.indicator];
        [self.contentView addSubview:self.loadingLable];
    }
    return self;
}

- (UIActivityIndicatorView *)indicator{
    if (!_indicator) {
        self.indicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyleGray)] autorelease];
        _indicator.frame = CGRectMake(80, 20, 0, 0);
    }
    return _indicator;
}

- (UILabel *)loadingLable{
    if (!_loadingLable) {
        self.loadingLable = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 40)] autorelease];
        _loadingLable.textAlignment = NSTextAlignmentCenter;
        _loadingLable.font = [UIFont systemFontOfSize:15];
        _loadingLable.text = @"正在加载中";
        _loadingLable.textColor = [UIColor grayColor];
    }
    return _loadingLable;
}

- (void)startLoading{
    [self.indicator startAnimating];//让风火轮开始转动
}

@end
